//
//  ZYCategorySecondCollectionViewCell.m
//  Adorable_Things
//
//  Created by huzhiyan on 16/1/12.
//  Copyright © 2016年 Banana Inc. All rights reserved.
//

#import "ZYCategorySecondCollectionViewCell.h"

@implementation ZYCategorySecondCollectionViewCell


- (void)awakeFromNib {
    // Initialization code
    self.layer.cornerRadius = 5;
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapGesture:)];
    [self.likeImageView addGestureRecognizer:tap];
    self.likeImageView.userInteractionEnabled = YES;
}


- (void)setModel:(ZYCategorySecondPageModel *)model
{
    _model = model;
    [_mainImageView sd_setImageWithURL:[NSURL URLWithString:model.pic_url]];
    _titleLabel.text = model.title;
    CGFloat price = [model.price floatValue];
    _priceLabel.text = [NSString stringWithFormat:@"￥%.2f",price];
    _favoriteLabel.text = [NSString stringWithFormat:@"人气 %@",model.favorite_num];
    _likeImageView.image = [UIImage imageNamed:@"iconfont-tubiao-2.png"];
    if ([model.favorite integerValue]) {
        _likeImageView.image = [UIImage imageNamed:@"iconfont-xihuan-2"];
    }
    
}

- (void)tapGesture:(UITapGestureRecognizer *)tap
{
    _block([NSString stringWithFormat:@"%@",_model.item_id]);
    
}


@end
